<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

<?define ProductName = "Sourcetrail" ?>
<?define ProductAuthor = "Coati Software KG" ?>
<?define ProductAppFolder = "InstallLocation" ?>

<?if $(sys.BUILDARCH) = x64 ?>
	<?define ProductDisplayName = "$(var.ProductName) 64-bit" ?>
	<?define ProductUpgradeCode = "693A35C7-8D56-4930-8653-1DC880D78678" ?>
	<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
	<?define ProductDisplayName = "$(var.ProductName)" ?>
	<?define ProductUpgradeCode = "6DAB9E05-6E5B-4D26-A2A0-8F1757F2A4EF" ?>
	<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>

    <Product
		Name='$(var.ProductDisplayName)'
		Manufacturer='$(var.ProductAuthor)'
		Id='$(var.ProductGuid)'
		UpgradeCode='$(var.ProductUpgradeCode)'
		Language='1033'
		Codepage='1252'
		Version='$(var.ProductVersion)'>

		<Package
			Id='*'
			Keywords='Installer'
			Description="$(var.ProductDisplayName) Installer"
			Comments='$(var.ProductName) is a registered trademark of $(var.ProductAuthor)'
			Manufacturer='$(var.ProductAuthor)'
			InstallerVersion='200'
			Languages='1033'
			Compressed='yes'
			SummaryCodepage='1252' />

		<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1' />

		<Property Id='DiskPrompt' Value="$(var.ProductDisplayName) Installation [1]" />
		<Property Id="INSTALLDESKTOPSHORTCUT" />
		<Property Id="INSTALLSTARTMENUSHORTCUT" Value="true" />

		<!-- Shortcuts -->
		<Upgrade Id='$(var.ProductUpgradeCode)'>
			<UpgradeVersion Property="REMOVINGTHEOLDVERSION" Minimum="0.0.0"    RemoveFeatures="ALL" />
			<UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
				Minimum='$(var.ProductVersion)' IncludeMinimum='yes'
				Maximum='$(var.ProductVersion)' IncludeMaximum='yes' />
			<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
				Minimum='$(var.ProductVersion)' IncludeMinimum='no' />
		</Upgrade>

		<Directory Id='TARGETDIR' Name='SourceDir'>

			<!-- This would be an alternative to include C++ runtime stuff, currently the required DLLs are included directly instead -->
			<!-- <Merge Id="VCRedist" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC140_CRT_x86.msm" DiskId="1" Language="0"/> -->

			<!-- Start menu (shortcuts) -->
			<Directory Id="ProgramMenuFolder" Name="Programs">
				<Directory Id="ProgramMenuDir" Name="$(var.ProductDisplayName)">
					<?if $(var.Win64)="yes" ?>
					<?define UninstallShortcut.Guid="95CDC4A0-98DC-42F9-BE37-574BAD663E5E" ?>
					<?else ?>
					<?define UninstallShortcut.Guid="CE39F8BF-83A6-4E73-A320-2930315909CA" ?>
					<?endif ?>
					<Component Id="UninstallShortcut" Guid="$(var.UninstallShortcut.Guid)" Win64="$(var.Win64)">
						<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
						<Shortcut Id="UninstallProduct"
								Name="Uninstall $(var.ProductDisplayName)"
								Description="Remove $(var.ProductDisplayName) from your computer"
								Target="[INSTALLDIR]uninstall.bat" />

						<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\SourcetrailUninstall" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
						<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
					</Component>

					<?if $(var.Win64)="yes" ?>
					<?define ApplicationShortcut.Guid="3D1E8D2E-CFD8-4267-82E4-D86C718046B0" ?>
					<?else ?>
					<?define ApplicationShortcut.Guid="29ED82EB-77D2-4721-BEE2-01250591FCC8" ?>
					<?endif ?>
					<Component Id="ApplicationShortcut" Guid="$(var.ApplicationShortcut.Guid)" Win64="$(var.Win64)">
						<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
						<Shortcut Id="ApplicationStartMenuShortcut"

									Name="$(var.ProductDisplayName)"
									Description="The Source Explorer"
									Target="[INSTALLDIR]Sourcetrail.exe"
									WorkingDirectory="INSTALLDIR"/>
						<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\SourcetrailShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
					</Component>
				</Directory>
			</Directory>

			<!-- Desktop menu (shortcuts) -->
			<Directory Id="DesktopFolder" Name="Desktop">
				<?if $(var.Win64)="yes" ?>
				<?define DesktopShortcut.Guid="2C7844DC-1B4C-4042-B215-D5C4A8F80D50" ?>
				<?else ?>
				<?define DesktopShortcut.Guid="86426318-27EC-431D-9BED-6C6CA4010F8E" ?>
				<?endif ?>
				<Component Id="DesktopShortcut" Guid="$(var.DesktopShortcut.Guid)" Win64="$(var.Win64)">
					<Condition>INSTALLDESKTOPSHORTCUT</Condition>
					<Shortcut Id="ApplicationDesktopShortcut"
								Name="$(var.ProductDisplayName)"
								Description="Source Explorer"
								Target="[INSTALLDIR]Sourcetrail.exe"
								WorkingDirectory="INSTALLDIR"/>
					<RemoveFolder Id="DesktopFolder" On="uninstall"/>
					<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\SourcetrailDesktop" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
				</Component>
			</Directory>

			<!-- Application Folder -->
			<Directory Id='$(var.PlatformProgramFilesFolder)' Name='PFiles'>
				<Directory Id='INSTALLDIR' Name='Sourcetrail' />
			</Directory>


			<!-- AppData Folder -->
			<Directory Id="LocalAppDataFolder">
				<Directory Id="CoatiSoftwareAppData" Name="Coati Software">

					<?if $(var.Win64)="yes" ?>
					<?define CoatiSoftwareAppDataDummy.Guid="8FA6F7E4-BDFB-406F-93CC-DA2AAD731BB1" ?>
					<?else ?>
					<?define CoatiSoftwareAppDataDummy.Guid="2A942F15-2FEB-494D-A3CA-A9ED9F43C200" ?>
					<?endif ?>
					<Component Id="CoatiSoftwareAppDataDummy" Guid="$(var.CoatiSoftwareAppDataDummy.Guid)" Win64="$(var.Win64)">
						<CreateFolder />
						<RemoveFolder Id='CoatiSoftwareAppData' On='uninstall' />
						<RegistryKey Action="none" Key="Software\[Manufacturer]\[ProductName]\sourcetrailSoftwareAppData" Root="HKCU" >
							<RegistryValue Type="integer" Value="1" KeyPath="yes" />
						</RegistryKey>
					</Component>

					<Directory Id="SourcetrailAppData" Name="$(var.ProductDisplayName)">
						<?if $(var.Win64)="yes" ?>
						<?define SourcetrailAppDataDummy.Guid="2318C48D-EFF4-4A6E-95F6-7E94EC14702C" ?>
						<?else ?>
						<?define SourcetrailAppDataDummy.Guid="340FED40-E14A-4DB3-ADE1-D39BAABB13F8" ?>
						<?endif ?>
						<Component Id="SourcetrailAppDataDummy" Guid="$(var.SourcetrailAppDataDummy.Guid)" Win64="$(var.Win64)">
							<CreateFolder />
							<RemoveFolder Id='SourcetrailAppData' On='uninstall' />
							<RegistryKey Action="none" Key="Software\[Manufacturer]\[ProductName]\sourcetrailAppData" Root="HKCU" >
								<RegistryValue Type="integer" Value="1" KeyPath="yes" />
							</RegistryKey>
						</Component>
					</Directory>
				</Directory>
			</Directory>
		</Directory>



		<Feature Id='Complete' Title='$(var.ProductDisplayName)' Description='Source Explorer' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
			<Feature Id='Program' Title='Program' Description='The main installation' Level='1'>
				<!-- Prerequisites -->
				<!-- <MergeRef Id='VCRedist'/> --> <!-- see comment at declaration -->

				<!-- Application Folder Stuff -->

				<ComponentRef Id='MainExecutable'/>

				<ComponentRef Id='ApplicationShortcut'/>
				<ComponentRef Id='DesktopShortcut'/>
				<ComponentRef Id='UninstallShortcut'/>

				<ComponentRef Id='SourcetrailIndexerExe'/>

				<ComponentRef Id='Qt5CoreDll'/>
				<ComponentRef Id='Qt5GuiDll'/>
				<ComponentRef Id='Qt5NetworkDll'/>
				<ComponentRef Id='Qt5SvgDll'/>
				<ComponentRef Id='Qt5WidgetsDll'/>
				<ComponentRef Id='Qt5WinExtrasDll'/>

				<ComponentRef Id='apiMsWinCoreConsole_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreDatetime_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreDebug_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreErrorhandling_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreFile_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreFile_l1_2_0Dll'/>
				<ComponentRef Id='apiMsWinCoreFile_l2_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreHandle_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreHeap_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreInterlocked_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreLibraryloader_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreLocalization_l1_2_0Dll'/>
				<ComponentRef Id='apiMsWinCoreMemory_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreNamedpipe_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreProcessEnvironment_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreProcessThreads_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreProcessThreads_l1_1_1Dll'/>
				<ComponentRef Id='apiMsWinCoreProfile_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreRtlSupport_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreString_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreSynch_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreSynch_l1_2_0Dll'/>
				<ComponentRef Id='apiMsWinCoreSysInfo_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreTimezone_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCoreUtil_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtConio_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtConvert_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtEnvironment_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtFilesystem_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtHeap_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtLocale_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtMath_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtMultibyte_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtPrivate_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtProcess_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtRuntime_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtStdio_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtString_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtTime_l1_1_0Dll'/>
				<ComponentRef Id='apiMsWinCrtUtility_l1_1_0Dll'/>
				<ComponentRef Id='libeay32_dll'/>
				<?if $(var.Win64) = "no" ?>
					<ComponentRef Id='libgcc_s_dw2_1_dll'/>
					<ComponentRef Id='libwinpthread_1_dll'/>
				<?endif ?>
				<ComponentRef Id='msvcp140_dll'/>
				<ComponentRef Id='qtConf'/>
				<ComponentRef Id='ssleay32_dll'/>
				<ComponentRef Id='ucrtbaseDll'/>
				<ComponentRef Id='vcruntime140_dll'/>

				<ComponentRef Id='qwindows_dll'/>
				<ComponentRef Id='qwindowsvistastyle_dll'/>
				<ComponentRef Id='QGifDll'/>
				<ComponentRef Id='QIcnsDll'/>
				<ComponentRef Id='QIcoDll'/>
				<ComponentRef Id='QJpegDll'/>
				<ComponentRef Id='QSvgDll'/>
				<ComponentRef Id='GTgaDll'/>
				<ComponentRef Id='QTiffDll'/>
				<ComponentRef Id='QWBmpDll'/>
				<ComponentRef Id='QWebpDll'/>

				<ComponentRef Id='LicenseBoostTxt'/>
				<ComponentRef Id='LicenseClangTxt'/>
				<ComponentRef Id='LicenseCppSqliteTxt'/>
				<ComponentRef Id='LicenseEclipseTxt'/>
				<ComponentRef Id='LicenseGradleTxt'/>
				<ComponentRef Id='LicenseOpensslTxt'/>
				<ComponentRef Id='LicenseQtTxt'/>
				<ComponentRef Id='LicenseTinyxmlTxt'/>

				<ComponentGroupRef Id='DataColorSchemesComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataCxxComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataFallbackComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataFontsComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataGuiComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataJavaComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataPythonComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='DataSyntaxHighlightingRulesComponentGroup' Primary="yes"/>

				<ComponentRef Id='UninstallBat'/>

				<!-- AppData Folder Stuff -->
				<ComponentRef Id='CoatiSoftwareAppDataDummy'/>
				<ComponentRef Id='SourcetrailAppDataDummy'/>

			<!-- </Feature> -->

			<!-- Sample Projects for AddData Folder -->
			<!-- <Feature Id='SampleCode' Title='Samples' Description='Tutorial and Sample Project' Level='1000'> -->
				<ComponentRef Id='SampleProjects'/>
				<ComponentGroupRef Id='SampleJavaparserComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='SampleTictactoeCppComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='SampleTictactoePyComponentGroup' Primary="yes"/>
				<ComponentGroupRef Id='SampleTutorialComponentGroup' Primary="yes"/>
			</Feature>
		</Feature>

		<CustomAction Id='AlreadyUpdated' Error='[ProductName] is already up to date.' />
		<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed' />

		<InstallExecuteSequence>
			<RemoveExistingProducts After="InstallInitialize" />
			<Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
			<Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERFOUND</Custom>
			<Custom Action='UninstallRemoveLogFolder' After='UnpublishComponents'>(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
		</InstallExecuteSequence>

		<!-- <UIRef Id="WixUI_InstallDir" /> -->

		<UI Id="MyWixUI_InstallDir">
			<UIRef Id="WixUI_InstallDir" />

			<DialogRef Id="ShortcutDlg" />
			
			<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="3">1</Publish>
			<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">1</Publish>
	 
			<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="ShortcutDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
			<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ShortcutDlg">1</Publish>
		</UI>

		<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

		<UIRef Id="WixUI_ErrorProgressText" />

		<Icon Id="Sourcetrail.ico" SourceFile="./../../../bin/app/data/gui/icon/sourcetrail.ico" />
		<Icon Id="Project.ico" SourceFile="./../../../bin/app/data/gui/icon/project.ico" />

		<WixVariable Id="WixUIBannerBmp" Value="Images/banner.bmp" />
		<WixVariable Id="WixUIDialogBmp" Value="Images/w_installer.bmp" />
	</Product>
</Wix>